<?php

namespace App\Http\Requests\keywords;

use App\Http\Requests\Request;

class AddRequests extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            "name" => "required|unique:hot_keywords",
            "num" => "required|regex:/\d+/",
        ];
    }

    public function messages() {
        return [
        "name.required" => "词汇名不能为空",
        "name.unique" => "词汇名已存在",
        "num.required" => "搜索量不能为空",
        "num.regex" => "请输入有效的数字",
        ];
    }
}
